package com.star.base.dao;

import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.UpdateProvider;

import java.util.Collection;

public interface UpdateListMapper<T>   {

    /**
     * 根据主键更新属性不为null的值
     * 要求：批量修改多条记录的字段及值都一样，如：批量修改更新人和更新时间
     *
     * @param records
     * @return
     */
    @UpdateProvider(type = UpdateListPlusProvider.class, method = "dynamicSQL")
    @Options(useCache = false, useGeneratedKeys = false)
    int updateBatchByIds(T records, Collection<String> ids);

    /**
     * 批量更新
     * @param records
     * @return
     */
    @UpdateProvider(type = UpdateListPlusProvider.class, method = "dynamicSQL")
    @Options(useCache = false, useGeneratedKeys = false)
    int updateBatchByPrimaryKeySelective(Collection<T> records);

}
